//----------------------------------------------------------------------- 
// PDS WITSMLstudio Core, 2018.3
//
// Copyright 2018 PDS Americas LLC
// 
// Licensed under the PDS Open Source WITSML Product License Agreement (the
// "License"); you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//   
//     http://www.pds.group/WITSMLstudio/OpenSource/ProductLicenseAgreement
// 
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//-----------------------------------------------------------------------

// ----------------------------------------------------------------------
// <auto-generated>
//     Changes to this file may cause incorrect behavior and will be lost
//     if the code is regenerated.
// </auto-generated>
// ----------------------------------------------------------------------
using System.Xml.Linq;
using PDS.WITSMLstudio.Data;
using WITSML141 = Energistics.DataAccess.WITSML141;
using WITSML131 = Energistics.DataAccess.WITSML131;

namespace PDS.WITSMLstudio.Query
{
    /// <summary>
    /// Provides helper methods to create query templates for WITSML data objects.
    /// </summary>
    public static partial class QueryTemplates
    {
        private static readonly DataObjectTemplate _template = new DataObjectTemplate();               

        /// <summary>
        /// Gets the template for Witsml131 objects.
        /// </summary>
        /// <param name="objectType">The object type.</param>
        /// <param name="returnElementsOptionIn">The returnElement optionsIn.</param>
        /// <returns>The XDocument.</returns>
        public static XDocument GetTemplateForWitsml131(string objectType, OptionsIn.ReturnElements returnElementsOptionIn)
        {
            var xDocument = new XDocument();

            switch (objectType)
            {
                case "bhaRun":
                    if (OptionsIn.ReturnElements.All.Equals(returnElementsOptionIn.Value))
                        xDocument = Witsml131.BhaRun.All;
                    else if (OptionsIn.ReturnElements.IdOnly.Equals(returnElementsOptionIn.Value))
                        xDocument = Witsml131.BhaRun.IdOnly;
                    break;
                case "cementJob":
                    if (OptionsIn.ReturnElements.All.Equals(returnElementsOptionIn.Value))
                        xDocument = Witsml131.CementJob.All;
                    else if (OptionsIn.ReturnElements.IdOnly.Equals(returnElementsOptionIn.Value))
                        xDocument = Witsml131.CementJob.IdOnly;
                    break;
                case "convCore":
                    if (OptionsIn.ReturnElements.All.Equals(returnElementsOptionIn.Value))
                        xDocument = Witsml131.ConvCore.All;
                    else if (OptionsIn.ReturnElements.IdOnly.Equals(returnElementsOptionIn.Value))
                        xDocument = Witsml131.ConvCore.IdOnly;
                    break;
                case "fluidsReport":
                    if (OptionsIn.ReturnElements.All.Equals(returnElementsOptionIn.Value))
                        xDocument = Witsml131.FluidsReport.All;
                    else if (OptionsIn.ReturnElements.IdOnly.Equals(returnElementsOptionIn.Value))
                        xDocument = Witsml131.FluidsReport.IdOnly;
                    break;
                case "formationMarker":
                    if (OptionsIn.ReturnElements.All.Equals(returnElementsOptionIn.Value))
                        xDocument = Witsml131.FormationMarker.All;
                    else if (OptionsIn.ReturnElements.IdOnly.Equals(returnElementsOptionIn.Value))
                        xDocument = Witsml131.FormationMarker.IdOnly;
                    break;
                case "log":
                    if (OptionsIn.ReturnElements.All.Equals(returnElementsOptionIn.Value))
                        xDocument = Witsml131.Log.All;
                    else if (OptionsIn.ReturnElements.IdOnly.Equals(returnElementsOptionIn.Value))
                        xDocument = Witsml131.Log.IdOnly;
                    if (OptionsIn.ReturnElements.HeaderOnly.Equals(returnElementsOptionIn.Value))
                        xDocument = Witsml131.Log.HeaderOnly;
                    else if (OptionsIn.ReturnElements.DataOnly.Equals(returnElementsOptionIn.Value))
                        xDocument = Witsml131.Log.DataOnly;
                    break;
                case "message":
                    if (OptionsIn.ReturnElements.All.Equals(returnElementsOptionIn.Value))
                        xDocument = Witsml131.Message.All;
                    else if (OptionsIn.ReturnElements.IdOnly.Equals(returnElementsOptionIn.Value))
                        xDocument = Witsml131.Message.IdOnly;
                    break;
                case "mudLog":
                    if (OptionsIn.ReturnElements.All.Equals(returnElementsOptionIn.Value))
                        xDocument = Witsml131.MudLog.All;
                    else if (OptionsIn.ReturnElements.IdOnly.Equals(returnElementsOptionIn.Value))
                        xDocument = Witsml131.MudLog.IdOnly;
                    if (OptionsIn.ReturnElements.HeaderOnly.Equals(returnElementsOptionIn.Value))
                        xDocument = Witsml131.MudLog.HeaderOnly;
                    else if (OptionsIn.ReturnElements.DataOnly.Equals(returnElementsOptionIn.Value))
                        xDocument = Witsml131.MudLog.DataOnly;
                    break;
                case "opsReport":
                    if (OptionsIn.ReturnElements.All.Equals(returnElementsOptionIn.Value))
                        xDocument = Witsml131.OpsReport.All;
                    else if (OptionsIn.ReturnElements.IdOnly.Equals(returnElementsOptionIn.Value))
                        xDocument = Witsml131.OpsReport.IdOnly;
                    break;
                case "rig":
                    if (OptionsIn.ReturnElements.All.Equals(returnElementsOptionIn.Value))
                        xDocument = Witsml131.Rig.All;
                    else if (OptionsIn.ReturnElements.IdOnly.Equals(returnElementsOptionIn.Value))
                        xDocument = Witsml131.Rig.IdOnly;
                    break;
                case "risk":
                    if (OptionsIn.ReturnElements.All.Equals(returnElementsOptionIn.Value))
                        xDocument = Witsml131.Risk.All;
                    else if (OptionsIn.ReturnElements.IdOnly.Equals(returnElementsOptionIn.Value))
                        xDocument = Witsml131.Risk.IdOnly;
                    break;
                case "sidewallCore":
                    if (OptionsIn.ReturnElements.All.Equals(returnElementsOptionIn.Value))
                        xDocument = Witsml131.SidewallCore.All;
                    else if (OptionsIn.ReturnElements.IdOnly.Equals(returnElementsOptionIn.Value))
                        xDocument = Witsml131.SidewallCore.IdOnly;
                    break;
                case "surveyProgram":
                    if (OptionsIn.ReturnElements.All.Equals(returnElementsOptionIn.Value))
                        xDocument = Witsml131.SurveyProgram.All;
                    else if (OptionsIn.ReturnElements.IdOnly.Equals(returnElementsOptionIn.Value))
                        xDocument = Witsml131.SurveyProgram.IdOnly;
                    break;
                case "target":
                    if (OptionsIn.ReturnElements.All.Equals(returnElementsOptionIn.Value))
                        xDocument = Witsml131.Target.All;
                    else if (OptionsIn.ReturnElements.IdOnly.Equals(returnElementsOptionIn.Value))
                        xDocument = Witsml131.Target.IdOnly;
                    break;
                case "trajectory":
                    if (OptionsIn.ReturnElements.All.Equals(returnElementsOptionIn.Value))
                        xDocument = Witsml131.Trajectory.All;
                    else if (OptionsIn.ReturnElements.IdOnly.Equals(returnElementsOptionIn.Value))
                        xDocument = Witsml131.Trajectory.IdOnly;
                    if (OptionsIn.ReturnElements.HeaderOnly.Equals(returnElementsOptionIn.Value))
                        xDocument = Witsml131.Trajectory.HeaderOnly;
                    else if (OptionsIn.ReturnElements.DataOnly.Equals(returnElementsOptionIn.Value))
                        xDocument = Witsml131.Trajectory.DataOnly;
                    else if (OptionsIn.ReturnElements.StationLocationOnly.Equals(returnElementsOptionIn.Value))
                        xDocument = Witsml131.Trajectory.StationLocationOnly;
                    break;
                case "tubular":
                    if (OptionsIn.ReturnElements.All.Equals(returnElementsOptionIn.Value))
                        xDocument = Witsml131.Tubular.All;
                    else if (OptionsIn.ReturnElements.IdOnly.Equals(returnElementsOptionIn.Value))
                        xDocument = Witsml131.Tubular.IdOnly;
                    break;
                case "wbGeometry":
                    if (OptionsIn.ReturnElements.All.Equals(returnElementsOptionIn.Value))
                        xDocument = Witsml131.WbGeometry.All;
                    else if (OptionsIn.ReturnElements.IdOnly.Equals(returnElementsOptionIn.Value))
                        xDocument = Witsml131.WbGeometry.IdOnly;
                    break;
                case "well":
                    if (OptionsIn.ReturnElements.All.Equals(returnElementsOptionIn.Value))
                        xDocument = Witsml131.Well.All;
                    else if (OptionsIn.ReturnElements.IdOnly.Equals(returnElementsOptionIn.Value))
                        xDocument = Witsml131.Well.IdOnly;
                    break;
                case "wellbore":
                    if (OptionsIn.ReturnElements.All.Equals(returnElementsOptionIn.Value))
                        xDocument = Witsml131.Wellbore.All;
                    else if (OptionsIn.ReturnElements.IdOnly.Equals(returnElementsOptionIn.Value))
                        xDocument = Witsml131.Wellbore.IdOnly;
                    break;
                case "wellLog":
                    if (OptionsIn.ReturnElements.All.Equals(returnElementsOptionIn.Value))
                        xDocument = Witsml131.WellLog.All;
                    else if (OptionsIn.ReturnElements.IdOnly.Equals(returnElementsOptionIn.Value))
                        xDocument = Witsml131.WellLog.IdOnly;
                    break;
            }

            return xDocument;
        }

        /// <summary>
        /// Gets the template for Witsml141 objects.
        /// </summary>
        /// <param name="objectType">The object type.</param>
        /// <param name="returnElementsOptionIn">The returnElement optionsIn.</param>
        /// <returns>The XDocument.</returns>
        public static XDocument GetTemplateForWitsml141(string objectType, OptionsIn.ReturnElements returnElementsOptionIn)
        {
            var xDocument = new XDocument();

            switch (objectType)
            {
                case "attachment":
                    if (OptionsIn.ReturnElements.All.Equals(returnElementsOptionIn.Value))
                        xDocument = Witsml141.Attachment.All;
                    else if (OptionsIn.ReturnElements.IdOnly.Equals(returnElementsOptionIn.Value))
                        xDocument = Witsml141.Attachment.IdOnly;
                    break;
                case "bhaRun":
                    if (OptionsIn.ReturnElements.All.Equals(returnElementsOptionIn.Value))
                        xDocument = Witsml141.BhaRun.All;
                    else if (OptionsIn.ReturnElements.IdOnly.Equals(returnElementsOptionIn.Value))
                        xDocument = Witsml141.BhaRun.IdOnly;
                    break;
                case "cementJob":
                    if (OptionsIn.ReturnElements.All.Equals(returnElementsOptionIn.Value))
                        xDocument = Witsml141.CementJob.All;
                    else if (OptionsIn.ReturnElements.IdOnly.Equals(returnElementsOptionIn.Value))
                        xDocument = Witsml141.CementJob.IdOnly;
                    break;
                case "convCore":
                    if (OptionsIn.ReturnElements.All.Equals(returnElementsOptionIn.Value))
                        xDocument = Witsml141.ConvCore.All;
                    else if (OptionsIn.ReturnElements.IdOnly.Equals(returnElementsOptionIn.Value))
                        xDocument = Witsml141.ConvCore.IdOnly;
                    break;
                case "depthRegImage":
                    if (OptionsIn.ReturnElements.All.Equals(returnElementsOptionIn.Value))
                        xDocument = Witsml141.DepthRegImage.All;
                    else if (OptionsIn.ReturnElements.IdOnly.Equals(returnElementsOptionIn.Value))
                        xDocument = Witsml141.DepthRegImage.IdOnly;
                    break;
                case "downholeComponent":
                    if (OptionsIn.ReturnElements.All.Equals(returnElementsOptionIn.Value))
                        xDocument = Witsml141.DownholeComponent.All;
                    else if (OptionsIn.ReturnElements.IdOnly.Equals(returnElementsOptionIn.Value))
                        xDocument = Witsml141.DownholeComponent.IdOnly;
                    break;
                case "drillReport":
                    if (OptionsIn.ReturnElements.All.Equals(returnElementsOptionIn.Value))
                        xDocument = Witsml141.DrillReport.All;
                    else if (OptionsIn.ReturnElements.IdOnly.Equals(returnElementsOptionIn.Value))
                        xDocument = Witsml141.DrillReport.IdOnly;
                    break;
                case "fluidsReport":
                    if (OptionsIn.ReturnElements.All.Equals(returnElementsOptionIn.Value))
                        xDocument = Witsml141.FluidsReport.All;
                    else if (OptionsIn.ReturnElements.IdOnly.Equals(returnElementsOptionIn.Value))
                        xDocument = Witsml141.FluidsReport.IdOnly;
                    break;
                case "formationMarker":
                    if (OptionsIn.ReturnElements.All.Equals(returnElementsOptionIn.Value))
                        xDocument = Witsml141.FormationMarker.All;
                    else if (OptionsIn.ReturnElements.IdOnly.Equals(returnElementsOptionIn.Value))
                        xDocument = Witsml141.FormationMarker.IdOnly;
                    break;
                case "log":
                    if (OptionsIn.ReturnElements.All.Equals(returnElementsOptionIn.Value))
                        xDocument = Witsml141.Log.All;
                    else if (OptionsIn.ReturnElements.IdOnly.Equals(returnElementsOptionIn.Value))
                        xDocument = Witsml141.Log.IdOnly;
                    if (OptionsIn.ReturnElements.HeaderOnly.Equals(returnElementsOptionIn.Value))
                        xDocument = Witsml141.Log.HeaderOnly;
                    else if (OptionsIn.ReturnElements.DataOnly.Equals(returnElementsOptionIn.Value))
                        xDocument = Witsml141.Log.DataOnly;
                    break;
                case "message":
                    if (OptionsIn.ReturnElements.All.Equals(returnElementsOptionIn.Value))
                        xDocument = Witsml141.Message.All;
                    else if (OptionsIn.ReturnElements.IdOnly.Equals(returnElementsOptionIn.Value))
                        xDocument = Witsml141.Message.IdOnly;
                    break;
                case "mudLog":
                    if (OptionsIn.ReturnElements.All.Equals(returnElementsOptionIn.Value))
                        xDocument = Witsml141.MudLog.All;
                    else if (OptionsIn.ReturnElements.IdOnly.Equals(returnElementsOptionIn.Value))
                        xDocument = Witsml141.MudLog.IdOnly;
                    if (OptionsIn.ReturnElements.HeaderOnly.Equals(returnElementsOptionIn.Value))
                        xDocument = Witsml141.MudLog.HeaderOnly;
                    else if (OptionsIn.ReturnElements.DataOnly.Equals(returnElementsOptionIn.Value))
                        xDocument = Witsml141.MudLog.DataOnly;
                    break;
                case "opsReport":
                    if (OptionsIn.ReturnElements.All.Equals(returnElementsOptionIn.Value))
                        xDocument = Witsml141.OpsReport.All;
                    else if (OptionsIn.ReturnElements.IdOnly.Equals(returnElementsOptionIn.Value))
                        xDocument = Witsml141.OpsReport.IdOnly;
                    break;
                case "rig":
                    if (OptionsIn.ReturnElements.All.Equals(returnElementsOptionIn.Value))
                        xDocument = Witsml141.Rig.All;
                    else if (OptionsIn.ReturnElements.IdOnly.Equals(returnElementsOptionIn.Value))
                        xDocument = Witsml141.Rig.IdOnly;
                    break;
                case "risk":
                    if (OptionsIn.ReturnElements.All.Equals(returnElementsOptionIn.Value))
                        xDocument = Witsml141.Risk.All;
                    else if (OptionsIn.ReturnElements.IdOnly.Equals(returnElementsOptionIn.Value))
                        xDocument = Witsml141.Risk.IdOnly;
                    break;
                case "sidewallCore":
                    if (OptionsIn.ReturnElements.All.Equals(returnElementsOptionIn.Value))
                        xDocument = Witsml141.SidewallCore.All;
                    else if (OptionsIn.ReturnElements.IdOnly.Equals(returnElementsOptionIn.Value))
                        xDocument = Witsml141.SidewallCore.IdOnly;
                    break;
                case "stimJob":
                    if (OptionsIn.ReturnElements.All.Equals(returnElementsOptionIn.Value))
                        xDocument = Witsml141.StimJob.All;
                    else if (OptionsIn.ReturnElements.IdOnly.Equals(returnElementsOptionIn.Value))
                        xDocument = Witsml141.StimJob.IdOnly;
                    break;
                case "surveyProgram":
                    if (OptionsIn.ReturnElements.All.Equals(returnElementsOptionIn.Value))
                        xDocument = Witsml141.SurveyProgram.All;
                    else if (OptionsIn.ReturnElements.IdOnly.Equals(returnElementsOptionIn.Value))
                        xDocument = Witsml141.SurveyProgram.IdOnly;
                    break;
                case "target":
                    if (OptionsIn.ReturnElements.All.Equals(returnElementsOptionIn.Value))
                        xDocument = Witsml141.Target.All;
                    else if (OptionsIn.ReturnElements.IdOnly.Equals(returnElementsOptionIn.Value))
                        xDocument = Witsml141.Target.IdOnly;
                    break;
                case "toolErrorModel":
                    if (OptionsIn.ReturnElements.All.Equals(returnElementsOptionIn.Value))
                        xDocument = Witsml141.ToolErrorModel.All;
                    else if (OptionsIn.ReturnElements.IdOnly.Equals(returnElementsOptionIn.Value))
                        xDocument = Witsml141.ToolErrorModel.IdOnly;
                    break;
                case "toolErrorTermSet":
                    if (OptionsIn.ReturnElements.All.Equals(returnElementsOptionIn.Value))
                        xDocument = Witsml141.ToolErrorTermSet.All;
                    else if (OptionsIn.ReturnElements.IdOnly.Equals(returnElementsOptionIn.Value))
                        xDocument = Witsml141.ToolErrorTermSet.IdOnly;
                    break;
                case "trajectory":
                    if (OptionsIn.ReturnElements.All.Equals(returnElementsOptionIn.Value))
                        xDocument = Witsml141.Trajectory.All;
                    else if (OptionsIn.ReturnElements.IdOnly.Equals(returnElementsOptionIn.Value))
                        xDocument = Witsml141.Trajectory.IdOnly;
                    if (OptionsIn.ReturnElements.HeaderOnly.Equals(returnElementsOptionIn.Value))
                        xDocument = Witsml141.Trajectory.HeaderOnly;
                    else if (OptionsIn.ReturnElements.DataOnly.Equals(returnElementsOptionIn.Value))
                        xDocument = Witsml141.Trajectory.DataOnly;
                    else if (OptionsIn.ReturnElements.StationLocationOnly.Equals(returnElementsOptionIn.Value))
                        xDocument = Witsml141.Trajectory.StationLocationOnly;
                    break;
                case "tubular":
                    if (OptionsIn.ReturnElements.All.Equals(returnElementsOptionIn.Value))
                        xDocument = Witsml141.Tubular.All;
                    else if (OptionsIn.ReturnElements.IdOnly.Equals(returnElementsOptionIn.Value))
                        xDocument = Witsml141.Tubular.IdOnly;
                    break;
                case "wbGeometry":
                    if (OptionsIn.ReturnElements.All.Equals(returnElementsOptionIn.Value))
                        xDocument = Witsml141.WbGeometry.All;
                    else if (OptionsIn.ReturnElements.IdOnly.Equals(returnElementsOptionIn.Value))
                        xDocument = Witsml141.WbGeometry.IdOnly;
                    break;
                case "well":
                    if (OptionsIn.ReturnElements.All.Equals(returnElementsOptionIn.Value))
                        xDocument = Witsml141.Well.All;
                    else if (OptionsIn.ReturnElements.IdOnly.Equals(returnElementsOptionIn.Value))
                        xDocument = Witsml141.Well.IdOnly;
                    break;
                case "wellbore":
                    if (OptionsIn.ReturnElements.All.Equals(returnElementsOptionIn.Value))
                        xDocument = Witsml141.Wellbore.All;
                    else if (OptionsIn.ReturnElements.IdOnly.Equals(returnElementsOptionIn.Value))
                        xDocument = Witsml141.Wellbore.IdOnly;
                    break;
                case "wellboreCompletion":
                    if (OptionsIn.ReturnElements.All.Equals(returnElementsOptionIn.Value))
                        xDocument = Witsml141.WellboreCompletion.All;
                    else if (OptionsIn.ReturnElements.IdOnly.Equals(returnElementsOptionIn.Value))
                        xDocument = Witsml141.WellboreCompletion.IdOnly;
                    break;
                case "wellCMLedger":
                    if (OptionsIn.ReturnElements.All.Equals(returnElementsOptionIn.Value))
                        xDocument = Witsml141.WellCMLedger.All;
                    else if (OptionsIn.ReturnElements.IdOnly.Equals(returnElementsOptionIn.Value))
                        xDocument = Witsml141.WellCMLedger.IdOnly;
                    break;
                case "wellCompletion":
                    if (OptionsIn.ReturnElements.All.Equals(returnElementsOptionIn.Value))
                        xDocument = Witsml141.WellCompletion.All;
                    else if (OptionsIn.ReturnElements.IdOnly.Equals(returnElementsOptionIn.Value))
                        xDocument = Witsml141.WellCompletion.IdOnly;
                    break;
            }

            return xDocument;
        }

        /// <summary>
        /// Provides helper methods to create Witsml131 query templates.
        /// </summary>
        public static class Witsml131
        {          
            /// <summary>
            /// Provides helper methods to create Witsml131 query templates for bhaRun.    
            /// </summary>          
            public static class BhaRun
            { 
                private static XDocument _all;
                private static XDocument _idOnly;

                /// <summary>
                /// Gets an all query template
                /// </summary>
                public static XDocument All
                {
                    get
                    {
                        if (_all != null) return Clone(_all);
                        _all = _template.Create<WITSML131.BhaRunList>();
                        return Clone(_all);
                    }
                }

                /// <summary>
                /// Gets an id-only query template.
                /// </summary>
                public static XDocument IdOnly
                {
                    get
                    {
                        if (_idOnly != null) return Clone(_idOnly);
                        var idOnly = _template.Create<WITSML131.BhaRunList>();
                        _template.RemoveAll(idOnly, "/*/*/*[name() != 'name' and name() != 'nameWell' and name() != 'nameWellbore']");
                        _idOnly = idOnly;
                        return Clone(_idOnly);
                    }
                }
            }
            /// <summary>
            /// Provides helper methods to create Witsml131 query templates for cementJob.    
            /// </summary>          
            public static class CementJob
            { 
                private static XDocument _all;
                private static XDocument _idOnly;

                /// <summary>
                /// Gets an all query template
                /// </summary>
                public static XDocument All
                {
                    get
                    {
                        if (_all != null) return Clone(_all);
                        _all = _template.Create<WITSML131.CementJobList>();
                        return Clone(_all);
                    }
                }

                /// <summary>
                /// Gets an id-only query template.
                /// </summary>
                public static XDocument IdOnly
                {
                    get
                    {
                        if (_idOnly != null) return Clone(_idOnly);
                        var idOnly = _template.Create<WITSML131.CementJobList>();
                        _template.RemoveAll(idOnly, "/*/*/*[name() != 'name' and name() != 'nameWell' and name() != 'nameWellbore']");
                        _idOnly = idOnly;
                        return Clone(_idOnly);
                    }
                }
            }
            /// <summary>
            /// Provides helper methods to create Witsml131 query templates for convCore.    
            /// </summary>          
            public static class ConvCore
            { 
                private static XDocument _all;
                private static XDocument _idOnly;

                /// <summary>
                /// Gets an all query template
                /// </summary>
                public static XDocument All
                {
                    get
                    {
                        if (_all != null) return Clone(_all);
                        _all = _template.Create<WITSML131.ConvCoreList>();
                        return Clone(_all);
                    }
                }

                /// <summary>
                /// Gets an id-only query template.
                /// </summary>
                public static XDocument IdOnly
                {
                    get
                    {
                        if (_idOnly != null) return Clone(_idOnly);
                        var idOnly = _template.Create<WITSML131.ConvCoreList>();
                        _template.RemoveAll(idOnly, "/*/*/*[name() != 'name' and name() != 'nameWell' and name() != 'nameWellbore']");
                        _idOnly = idOnly;
                        return Clone(_idOnly);
                    }
                }
            }
            /// <summary>
            /// Provides helper methods to create Witsml131 query templates for fluidsReport.    
            /// </summary>          
            public static class FluidsReport
            { 
                private static XDocument _all;
                private static XDocument _idOnly;

                /// <summary>
                /// Gets an all query template
                /// </summary>
                public static XDocument All
                {
                    get
                    {
                        if (_all != null) return Clone(_all);
                        _all = _template.Create<WITSML131.FluidsReportList>();
                        return Clone(_all);
                    }
                }

                /// <summary>
                /// Gets an id-only query template.
                /// </summary>
                public static XDocument IdOnly
                {
                    get
                    {
                        if (_idOnly != null) return Clone(_idOnly);
                        var idOnly = _template.Create<WITSML131.FluidsReportList>();
                        _template.RemoveAll(idOnly, "/*/*/*[name() != 'name' and name() != 'nameWell' and name() != 'nameWellbore']");
                        _idOnly = idOnly;
                        return Clone(_idOnly);
                    }
                }
            }
            /// <summary>
            /// Provides helper methods to create Witsml131 query templates for formationMarker.    
            /// </summary>          
            public static class FormationMarker
            { 
                private static XDocument _all;
                private static XDocument _idOnly;

                /// <summary>
                /// Gets an all query template
                /// </summary>
                public static XDocument All
                {
                    get
                    {
                        if (_all != null) return Clone(_all);
                        _all = _template.Create<WITSML131.FormationMarkerList>();
                        return Clone(_all);
                    }
                }

                /// <summary>
                /// Gets an id-only query template.
                /// </summary>
                public static XDocument IdOnly
                {
                    get
                    {
                        if (_idOnly != null) return Clone(_idOnly);
                        var idOnly = _template.Create<WITSML131.FormationMarkerList>();
                        _template.RemoveAll(idOnly, "/*/*/*[name() != 'name' and name() != 'nameWell' and name() != 'nameWellbore']");
                        _idOnly = idOnly;
                        return Clone(_idOnly);
                    }
                }
            }
            /// <summary>
            /// Provides helper methods to create Witsml131 query templates for log.    
            /// </summary>          
            public static class Log
            { 
                private static XDocument _all;
                private static XDocument _idOnly;
                private static XDocument _headerOnly;
                private static XDocument _dataOnly;

                /// <summary>
                /// Gets an all query template
                /// </summary>
                public static XDocument All
                {
                    get
                    {
                        if (_all != null) return Clone(_all);
                        _all = _template.Create<WITSML131.LogList>();
                        return Clone(_all);
                    }
                }

                /// <summary>
                /// Gets an id-only query template.
                /// </summary>
                public static XDocument IdOnly
                {
                    get
                    {
                        if (_idOnly != null) return Clone(_idOnly);
                        var idOnly = _template.Create<WITSML131.LogList>();
                        _template.RemoveAll(idOnly, "/*/*/*[name() != 'name' and name() != 'nameWell' and name() != 'nameWellbore']");
                        _idOnly = idOnly;
                        return Clone(_idOnly);
                    }
                }
                /// <summary>
                /// Create a header only query template.
                /// </summary>
                /// <returns></returns>
                public static XDocument HeaderOnly
                {
                    get
                    {
                        if (_headerOnly != null) return Clone(_headerOnly);
                        var headerOnly = _template.Create<WITSML131.LogList>();
                        _template.Remove(headerOnly, "//logData");
                        _headerOnly = headerOnly;
                        return Clone(_headerOnly);
                    }
                }

                /// <summary>
                ///  Create a data only query template.
                /// </summary>
                /// <returns></returns>
                public static XDocument DataOnly
                {
                    get
                    {
                        if (_dataOnly != null) return Clone(_dataOnly);
                        var dataOnly = _template.Create<WITSML131.LogList>();
                        _template.RemoveAll(dataOnly, "/*/*/*[name()!='logData']");
                        _dataOnly = dataOnly;
                        return Clone(_dataOnly);
                    }
                }

            }
            /// <summary>
            /// Provides helper methods to create Witsml131 query templates for message.    
            /// </summary>          
            public static class Message
            { 
                private static XDocument _all;
                private static XDocument _idOnly;

                /// <summary>
                /// Gets an all query template
                /// </summary>
                public static XDocument All
                {
                    get
                    {
                        if (_all != null) return Clone(_all);
                        _all = _template.Create<WITSML131.MessageList>();
                        return Clone(_all);
                    }
                }

                /// <summary>
                /// Gets an id-only query template.
                /// </summary>
                public static XDocument IdOnly
                {
                    get
                    {
                        if (_idOnly != null) return Clone(_idOnly);
                        var idOnly = _template.Create<WITSML131.MessageList>();
                        _template.RemoveAll(idOnly, "/*/*/*[name() != 'name' and name() != 'nameWell' and name() != 'nameWellbore']");
                        _idOnly = idOnly;
                        return Clone(_idOnly);
                    }
                }
            }
            /// <summary>
            /// Provides helper methods to create Witsml131 query templates for mudLog.    
            /// </summary>          
            public static class MudLog
            { 
                private static XDocument _all;
                private static XDocument _idOnly;
                private static XDocument _headerOnly;
                private static XDocument _dataOnly;

                /// <summary>
                /// Gets an all query template
                /// </summary>
                public static XDocument All
                {
                    get
                    {
                        if (_all != null) return Clone(_all);
                        _all = _template.Create<WITSML131.MudLogList>();
                        return Clone(_all);
                    }
                }

                /// <summary>
                /// Gets an id-only query template.
                /// </summary>
                public static XDocument IdOnly
                {
                    get
                    {
                        if (_idOnly != null) return Clone(_idOnly);
                        var idOnly = _template.Create<WITSML131.MudLogList>();
                        _template.RemoveAll(idOnly, "/*/*/*[name() != 'name' and name() != 'nameWell' and name() != 'nameWellbore']");
                        _idOnly = idOnly;
                        return Clone(_idOnly);
                    }
                }
                /// <summary>
                /// Create a header only query template.
                /// </summary>
                /// <returns></returns>
                public static XDocument HeaderOnly
                {
                    get
                    {
                        if (_headerOnly != null) return Clone(_headerOnly);
                        var headerOnly = _template.Create<WITSML131.MudLogList>();
                        _template.Remove(headerOnly, "//geologyInterval");
                        _headerOnly = headerOnly;
                        return Clone(_headerOnly);
                    }
                }

                /// <summary>
                ///  Create a data only query template.
                /// </summary>
                /// <returns></returns>
                public static XDocument DataOnly
                {
                    get
                    {
                        if (_dataOnly != null) return Clone(_dataOnly);
                        var dataOnly = _template.Create<WITSML131.MudLogList>();
                        _template.RemoveAll(dataOnly, "/*/*/*[name()!='geologyInterval']");
                        _dataOnly = dataOnly;
                        return Clone(_dataOnly);
                    }
                }

            }
            /// <summary>
            /// Provides helper methods to create Witsml131 query templates for opsReport.    
            /// </summary>          
            public static class OpsReport
            { 
                private static XDocument _all;
                private static XDocument _idOnly;

                /// <summary>
                /// Gets an all query template
                /// </summary>
                public static XDocument All
                {
                    get
                    {
                        if (_all != null) return Clone(_all);
                        _all = _template.Create<WITSML131.OpsReportList>();
                        return Clone(_all);
                    }
                }

                /// <summary>
                /// Gets an id-only query template.
                /// </summary>
                public static XDocument IdOnly
                {
                    get
                    {
                        if (_idOnly != null) return Clone(_idOnly);
                        var idOnly = _template.Create<WITSML131.OpsReportList>();
                        _template.RemoveAll(idOnly, "/*/*/*[name() != 'name' and name() != 'nameWell' and name() != 'nameWellbore']");
                        _idOnly = idOnly;
                        return Clone(_idOnly);
                    }
                }
            }
            /// <summary>
            /// Provides helper methods to create Witsml131 query templates for rig.    
            /// </summary>          
            public static class Rig
            { 
                private static XDocument _all;
                private static XDocument _idOnly;

                /// <summary>
                /// Gets an all query template
                /// </summary>
                public static XDocument All
                {
                    get
                    {
                        if (_all != null) return Clone(_all);
                        _all = _template.Create<WITSML131.RigList>();
                        return Clone(_all);
                    }
                }

                /// <summary>
                /// Gets an id-only query template.
                /// </summary>
                public static XDocument IdOnly
                {
                    get
                    {
                        if (_idOnly != null) return Clone(_idOnly);
                        var idOnly = _template.Create<WITSML131.RigList>();
                        _template.RemoveAll(idOnly, "/*/*/*[name() != 'name' and name() != 'nameWell' and name() != 'nameWellbore']");
                        _idOnly = idOnly;
                        return Clone(_idOnly);
                    }
                }
            }
            /// <summary>
            /// Provides helper methods to create Witsml131 query templates for risk.    
            /// </summary>          
            public static class Risk
            { 
                private static XDocument _all;
                private static XDocument _idOnly;

                /// <summary>
                /// Gets an all query template
                /// </summary>
                public static XDocument All
                {
                    get
                    {
                        if (_all != null) return Clone(_all);
                        _all = _template.Create<WITSML131.RiskList>();
                        return Clone(_all);
                    }
                }

                /// <summary>
                /// Gets an id-only query template.
                /// </summary>
                public static XDocument IdOnly
                {
                    get
                    {
                        if (_idOnly != null) return Clone(_idOnly);
                        var idOnly = _template.Create<WITSML131.RiskList>();
                        _template.RemoveAll(idOnly, "/*/*/*[name() != 'name' and name() != 'nameWell' and name() != 'nameWellbore']");
                        _idOnly = idOnly;
                        return Clone(_idOnly);
                    }
                }
            }
            /// <summary>
            /// Provides helper methods to create Witsml131 query templates for sidewallCore.    
            /// </summary>          
            public static class SidewallCore
            { 
                private static XDocument _all;
                private static XDocument _idOnly;

                /// <summary>
                /// Gets an all query template
                /// </summary>
                public static XDocument All
                {
                    get
                    {
                        if (_all != null) return Clone(_all);
                        _all = _template.Create<WITSML131.SidewallCoreList>();
                        return Clone(_all);
                    }
                }

                /// <summary>
                /// Gets an id-only query template.
                /// </summary>
                public static XDocument IdOnly
                {
                    get
                    {
                        if (_idOnly != null) return Clone(_idOnly);
                        var idOnly = _template.Create<WITSML131.SidewallCoreList>();
                        _template.RemoveAll(idOnly, "/*/*/*[name() != 'name' and name() != 'nameWell' and name() != 'nameWellbore']");
                        _idOnly = idOnly;
                        return Clone(_idOnly);
                    }
                }
            }
            /// <summary>
            /// Provides helper methods to create Witsml131 query templates for surveyProgram.    
            /// </summary>          
            public static class SurveyProgram
            { 
                private static XDocument _all;
                private static XDocument _idOnly;

                /// <summary>
                /// Gets an all query template
                /// </summary>
                public static XDocument All
                {
                    get
                    {
                        if (_all != null) return Clone(_all);
                        _all = _template.Create<WITSML131.SurveyProgramList>();
                        return Clone(_all);
                    }
                }

                /// <summary>
                /// Gets an id-only query template.
                /// </summary>
                public static XDocument IdOnly
                {
                    get
                    {
                        if (_idOnly != null) return Clone(_idOnly);
                        var idOnly = _template.Create<WITSML131.SurveyProgramList>();
                        _template.RemoveAll(idOnly, "/*/*/*[name() != 'name' and name() != 'nameWell' and name() != 'nameWellbore']");
                        _idOnly = idOnly;
                        return Clone(_idOnly);
                    }
                }
            }
            /// <summary>
            /// Provides helper methods to create Witsml131 query templates for target.    
            /// </summary>          
            public static class Target
            { 
                private static XDocument _all;
                private static XDocument _idOnly;

                /// <summary>
                /// Gets an all query template
                /// </summary>
                public static XDocument All
                {
                    get
                    {
                        if (_all != null) return Clone(_all);
                        _all = _template.Create<WITSML131.TargetList>();
                        return Clone(_all);
                    }
                }

                /// <summary>
                /// Gets an id-only query template.
                /// </summary>
                public static XDocument IdOnly
                {
                    get
                    {
                        if (_idOnly != null) return Clone(_idOnly);
                        var idOnly = _template.Create<WITSML131.TargetList>();
                        _template.RemoveAll(idOnly, "/*/*/*[name() != 'name' and name() != 'nameWell' and name() != 'nameWellbore']");
                        _idOnly = idOnly;
                        return Clone(_idOnly);
                    }
                }
            }
            /// <summary>
            /// Provides helper methods to create Witsml131 query templates for trajectory.    
            /// </summary>          
            public static class Trajectory
            { 
                private static XDocument _all;
                private static XDocument _idOnly;
                private static XDocument _headerOnly;
                private static XDocument _dataOnly;
                private static XDocument _stationLocationOnly;

                /// <summary>
                /// Gets an all query template
                /// </summary>
                public static XDocument All
                {
                    get
                    {
                        if (_all != null) return Clone(_all);
                        _all = _template.Create<WITSML131.TrajectoryList>();
                        return Clone(_all);
                    }
                }

                /// <summary>
                /// Gets an id-only query template.
                /// </summary>
                public static XDocument IdOnly
                {
                    get
                    {
                        if (_idOnly != null) return Clone(_idOnly);
                        var idOnly = _template.Create<WITSML131.TrajectoryList>();
                        _template.RemoveAll(idOnly, "/*/*/*[name() != 'name' and name() != 'nameWell' and name() != 'nameWellbore']");
                        _idOnly = idOnly;
                        return Clone(_idOnly);
                    }
                }
                /// <summary>
                /// Create a header only query template.
                /// </summary>
                /// <returns></returns>
                public static XDocument HeaderOnly
                {
                    get
                    {
                        if (_headerOnly != null) return Clone(_headerOnly);
                        var headerOnly = _template.Create<WITSML131.TrajectoryList>();
                        _template.Remove(headerOnly, "//trajectoryStation");
                        _headerOnly = headerOnly;
                        return Clone(_headerOnly);
                    }
                }

                /// <summary>
                ///  Create a data only query template.
                /// </summary>
                /// <returns></returns>
                public static XDocument DataOnly
                {
                    get
                    {
                        if (_dataOnly != null) return Clone(_dataOnly);
                        var dataOnly = _template.Create<WITSML131.TrajectoryList>();
                        _template.RemoveAll(dataOnly, "/*/*/*[name()!='trajectoryStation']");
                        _dataOnly = dataOnly;
                        return Clone(_dataOnly);
                    }
                }

                /// <summary>
                ///  Create a station location only query template.
                /// </summary>
                /// <returns></returns>
                public static XDocument StationLocationOnly
                {
                    get
                    {
                        if (_stationLocationOnly != null) return Clone(_stationLocationOnly);
                        var stationLocationOnly = _template.Create<WITSML131.TrajectoryList>();
                        _template.RemoveAll(stationLocationOnly, "/*/*/*[name()!='trajectoryStation']");
                        _template.RemoveAll(stationLocationOnly, "/*/*/*/*[name() != 'dTimStn' and name() != 'typeTrajStation' and name() != 'md' and name() != 'tvd' and name() != 'incl' and name() != 'azi' and name() != 'location']");
                        _stationLocationOnly = stationLocationOnly;
                        return Clone(_stationLocationOnly);
                    }
                }

            }
            /// <summary>
            /// Provides helper methods to create Witsml131 query templates for tubular.    
            /// </summary>          
            public static class Tubular
            { 
                private static XDocument _all;
                private static XDocument _idOnly;

                /// <summary>
                /// Gets an all query template
                /// </summary>
                public static XDocument All
                {
                    get
                    {
                        if (_all != null) return Clone(_all);
                        _all = _template.Create<WITSML131.TubularList>();
                        return Clone(_all);
                    }
                }

                /// <summary>
                /// Gets an id-only query template.
                /// </summary>
                public static XDocument IdOnly
                {
                    get
                    {
                        if (_idOnly != null) return Clone(_idOnly);
                        var idOnly = _template.Create<WITSML131.TubularList>();
                        _template.RemoveAll(idOnly, "/*/*/*[name() != 'name' and name() != 'nameWell' and name() != 'nameWellbore']");
                        _idOnly = idOnly;
                        return Clone(_idOnly);
                    }
                }
            }
            /// <summary>
            /// Provides helper methods to create Witsml131 query templates for wbGeometry.    
            /// </summary>          
            public static class WbGeometry
            { 
                private static XDocument _all;
                private static XDocument _idOnly;

                /// <summary>
                /// Gets an all query template
                /// </summary>
                public static XDocument All
                {
                    get
                    {
                        if (_all != null) return Clone(_all);
                        _all = _template.Create<WITSML131.WellboreGeometryList>();
                        return Clone(_all);
                    }
                }

                /// <summary>
                /// Gets an id-only query template.
                /// </summary>
                public static XDocument IdOnly
                {
                    get
                    {
                        if (_idOnly != null) return Clone(_idOnly);
                        var idOnly = _template.Create<WITSML131.WellboreGeometryList>();
                        _template.RemoveAll(idOnly, "/*/*/*[name() != 'name' and name() != 'nameWell' and name() != 'nameWellbore']");
                        _idOnly = idOnly;
                        return Clone(_idOnly);
                    }
                }
            }
            /// <summary>
            /// Provides helper methods to create Witsml131 query templates for well.    
            /// </summary>          
            public static class Well
            { 
                private static XDocument _all;
                private static XDocument _idOnly;

                /// <summary>
                /// Gets an all query template
                /// </summary>
                public static XDocument All
                {
                    get
                    {
                        if (_all != null) return Clone(_all);
                        _all = _template.Create<WITSML131.WellList>();
                        return Clone(_all);
                    }
                }

                /// <summary>
                /// Gets an id-only query template.
                /// </summary>
                public static XDocument IdOnly
                {
                    get
                    {
                        if (_idOnly != null) return Clone(_idOnly);
                        var idOnly = _template.Create<WITSML131.WellList>();
                        _template.RemoveAll(idOnly, "/*/*/*[name() != 'name' ]");
                        _idOnly = idOnly;
                        return Clone(_idOnly);
                    }
                }
            }
            /// <summary>
            /// Provides helper methods to create Witsml131 query templates for wellbore.    
            /// </summary>          
            public static class Wellbore
            { 
                private static XDocument _all;
                private static XDocument _idOnly;

                /// <summary>
                /// Gets an all query template
                /// </summary>
                public static XDocument All
                {
                    get
                    {
                        if (_all != null) return Clone(_all);
                        _all = _template.Create<WITSML131.WellboreList>();
                        return Clone(_all);
                    }
                }

                /// <summary>
                /// Gets an id-only query template.
                /// </summary>
                public static XDocument IdOnly
                {
                    get
                    {
                        if (_idOnly != null) return Clone(_idOnly);
                        var idOnly = _template.Create<WITSML131.WellboreList>();
                        _template.RemoveAll(idOnly, "/*/*/*[name() != 'name' and name() != 'nameWell']");
                        _idOnly = idOnly;
                        return Clone(_idOnly);
                    }
                }
            }
            /// <summary>
            /// Provides helper methods to create Witsml131 query templates for wellLog.    
            /// </summary>          
            public static class WellLog
            { 
                private static XDocument _all;
                private static XDocument _idOnly;

                /// <summary>
                /// Gets an all query template
                /// </summary>
                public static XDocument All
                {
                    get
                    {
                        if (_all != null) return Clone(_all);
                        _all = _template.Create<WITSML131.WellLogList>();
                        return Clone(_all);
                    }
                }

                /// <summary>
                /// Gets an id-only query template.
                /// </summary>
                public static XDocument IdOnly
                {
                    get
                    {
                        if (_idOnly != null) return Clone(_idOnly);
                        var idOnly = _template.Create<WITSML131.WellLogList>();
                        _template.RemoveAll(idOnly, "/*/*/*[name() != 'name' and name() != 'nameWell' and name() != 'nameWellbore']");
                        _idOnly = idOnly;
                        return Clone(_idOnly);
                    }
                }
            }
        }
        /// <summary>
        /// Provides helper methods to create Witsml141 query templates.
        /// </summary>
        public static class Witsml141
        {          
            /// <summary>
            /// Provides helper methods to create Witsml141 query templates for attachment.    
            /// </summary>          
            public static class Attachment
            { 
                private static XDocument _all;
                private static XDocument _idOnly;

                /// <summary>
                /// Gets an all query template
                /// </summary>
                public static XDocument All
                {
                    get
                    {
                        if (_all != null) return Clone(_all);
                        _all = _template.Create<WITSML141.AttachmentList>();
                        return Clone(_all);
                    }
                }

                /// <summary>
                /// Gets an id-only query template.
                /// </summary>
                public static XDocument IdOnly
                {
                    get
                    {
                        if (_idOnly != null) return Clone(_idOnly);
                        var idOnly = _template.Create<WITSML141.AttachmentList>();
                        _template.RemoveAll(idOnly, "/*/*/*[name() != 'name' and name() != 'nameWell' and name() != 'nameWellbore']");
                        _idOnly = idOnly;
                        return Clone(_idOnly);
                    }
                }
            }
            /// <summary>
            /// Provides helper methods to create Witsml141 query templates for bhaRun.    
            /// </summary>          
            public static class BhaRun
            { 
                private static XDocument _all;
                private static XDocument _idOnly;

                /// <summary>
                /// Gets an all query template
                /// </summary>
                public static XDocument All
                {
                    get
                    {
                        if (_all != null) return Clone(_all);
                        _all = _template.Create<WITSML141.BhaRunList>();
                        return Clone(_all);
                    }
                }

                /// <summary>
                /// Gets an id-only query template.
                /// </summary>
                public static XDocument IdOnly
                {
                    get
                    {
                        if (_idOnly != null) return Clone(_idOnly);
                        var idOnly = _template.Create<WITSML141.BhaRunList>();
                        _template.RemoveAll(idOnly, "/*/*/*[name() != 'name' and name() != 'nameWell' and name() != 'nameWellbore']");
                        _idOnly = idOnly;
                        return Clone(_idOnly);
                    }
                }
            }
            /// <summary>
            /// Provides helper methods to create Witsml141 query templates for cementJob.    
            /// </summary>          
            public static class CementJob
            { 
                private static XDocument _all;
                private static XDocument _idOnly;

                /// <summary>
                /// Gets an all query template
                /// </summary>
                public static XDocument All
                {
                    get
                    {
                        if (_all != null) return Clone(_all);
                        _all = _template.Create<WITSML141.CementJobList>();
                        return Clone(_all);
                    }
                }

                /// <summary>
                /// Gets an id-only query template.
                /// </summary>
                public static XDocument IdOnly
                {
                    get
                    {
                        if (_idOnly != null) return Clone(_idOnly);
                        var idOnly = _template.Create<WITSML141.CementJobList>();
                        _template.RemoveAll(idOnly, "/*/*/*[name() != 'name' and name() != 'nameWell' and name() != 'nameWellbore']");
                        _idOnly = idOnly;
                        return Clone(_idOnly);
                    }
                }
            }
            /// <summary>
            /// Provides helper methods to create Witsml141 query templates for convCore.    
            /// </summary>          
            public static class ConvCore
            { 
                private static XDocument _all;
                private static XDocument _idOnly;

                /// <summary>
                /// Gets an all query template
                /// </summary>
                public static XDocument All
                {
                    get
                    {
                        if (_all != null) return Clone(_all);
                        _all = _template.Create<WITSML141.ConvCoreList>();
                        return Clone(_all);
                    }
                }

                /// <summary>
                /// Gets an id-only query template.
                /// </summary>
                public static XDocument IdOnly
                {
                    get
                    {
                        if (_idOnly != null) return Clone(_idOnly);
                        var idOnly = _template.Create<WITSML141.ConvCoreList>();
                        _template.RemoveAll(idOnly, "/*/*/*[name() != 'name' and name() != 'nameWell' and name() != 'nameWellbore']");
                        _idOnly = idOnly;
                        return Clone(_idOnly);
                    }
                }
            }
            /// <summary>
            /// Provides helper methods to create Witsml141 query templates for depthRegImage.    
            /// </summary>          
            public static class DepthRegImage
            { 
                private static XDocument _all;
                private static XDocument _idOnly;

                /// <summary>
                /// Gets an all query template
                /// </summary>
                public static XDocument All
                {
                    get
                    {
                        if (_all != null) return Clone(_all);
                        _all = _template.Create<WITSML141.DepthRegImageList>();
                        return Clone(_all);
                    }
                }

                /// <summary>
                /// Gets an id-only query template.
                /// </summary>
                public static XDocument IdOnly
                {
                    get
                    {
                        if (_idOnly != null) return Clone(_idOnly);
                        var idOnly = _template.Create<WITSML141.DepthRegImageList>();
                        _template.RemoveAll(idOnly, "/*/*/*[name() != 'name' and name() != 'nameWell' and name() != 'nameWellbore']");
                        _idOnly = idOnly;
                        return Clone(_idOnly);
                    }
                }
            }
            /// <summary>
            /// Provides helper methods to create Witsml141 query templates for downholeComponent.    
            /// </summary>          
            public static class DownholeComponent
            { 
                private static XDocument _all;
                private static XDocument _idOnly;

                /// <summary>
                /// Gets an all query template
                /// </summary>
                public static XDocument All
                {
                    get
                    {
                        if (_all != null) return Clone(_all);
                        _all = _template.Create<WITSML141.DownholeComponentList>();
                        return Clone(_all);
                    }
                }

                /// <summary>
                /// Gets an id-only query template.
                /// </summary>
                public static XDocument IdOnly
                {
                    get
                    {
                        if (_idOnly != null) return Clone(_idOnly);
                        var idOnly = _template.Create<WITSML141.DownholeComponentList>();
                        _template.RemoveAll(idOnly, "/*/*/*[name() != 'name' and name() != 'nameWell' and name() != 'nameWellbore']");
                        _idOnly = idOnly;
                        return Clone(_idOnly);
                    }
                }
            }
            /// <summary>
            /// Provides helper methods to create Witsml141 query templates for drillReport.    
            /// </summary>          
            public static class DrillReport
            { 
                private static XDocument _all;
                private static XDocument _idOnly;

                /// <summary>
                /// Gets an all query template
                /// </summary>
                public static XDocument All
                {
                    get
                    {
                        if (_all != null) return Clone(_all);
                        _all = _template.Create<WITSML141.DrillReportList>();
                        return Clone(_all);
                    }
                }

                /// <summary>
                /// Gets an id-only query template.
                /// </summary>
                public static XDocument IdOnly
                {
                    get
                    {
                        if (_idOnly != null) return Clone(_idOnly);
                        var idOnly = _template.Create<WITSML141.DrillReportList>();
                        _template.RemoveAll(idOnly, "/*/*/*[name() != 'name' and name() != 'nameWell' and name() != 'nameWellbore']");
                        _idOnly = idOnly;
                        return Clone(_idOnly);
                    }
                }
            }
            /// <summary>
            /// Provides helper methods to create Witsml141 query templates for fluidsReport.    
            /// </summary>          
            public static class FluidsReport
            { 
                private static XDocument _all;
                private static XDocument _idOnly;

                /// <summary>
                /// Gets an all query template
                /// </summary>
                public static XDocument All
                {
                    get
                    {
                        if (_all != null) return Clone(_all);
                        _all = _template.Create<WITSML141.FluidsReportList>();
                        return Clone(_all);
                    }
                }

                /// <summary>
                /// Gets an id-only query template.
                /// </summary>
                public static XDocument IdOnly
                {
                    get
                    {
                        if (_idOnly != null) return Clone(_idOnly);
                        var idOnly = _template.Create<WITSML141.FluidsReportList>();
                        _template.RemoveAll(idOnly, "/*/*/*[name() != 'name' and name() != 'nameWell' and name() != 'nameWellbore']");
                        _idOnly = idOnly;
                        return Clone(_idOnly);
                    }
                }
            }
            /// <summary>
            /// Provides helper methods to create Witsml141 query templates for formationMarker.    
            /// </summary>          
            public static class FormationMarker
            { 
                private static XDocument _all;
                private static XDocument _idOnly;

                /// <summary>
                /// Gets an all query template
                /// </summary>
                public static XDocument All
                {
                    get
                    {
                        if (_all != null) return Clone(_all);
                        _all = _template.Create<WITSML141.FormationMarkerList>();
                        return Clone(_all);
                    }
                }

                /// <summary>
                /// Gets an id-only query template.
                /// </summary>
                public static XDocument IdOnly
                {
                    get
                    {
                        if (_idOnly != null) return Clone(_idOnly);
                        var idOnly = _template.Create<WITSML141.FormationMarkerList>();
                        _template.RemoveAll(idOnly, "/*/*/*[name() != 'name' and name() != 'nameWell' and name() != 'nameWellbore']");
                        _idOnly = idOnly;
                        return Clone(_idOnly);
                    }
                }
            }
            /// <summary>
            /// Provides helper methods to create Witsml141 query templates for log.    
            /// </summary>          
            public static class Log
            { 
                private static XDocument _all;
                private static XDocument _idOnly;
                private static XDocument _headerOnly;
                private static XDocument _dataOnly;

                /// <summary>
                /// Gets an all query template
                /// </summary>
                public static XDocument All
                {
                    get
                    {
                        if (_all != null) return Clone(_all);
                        _all = _template.Create<WITSML141.LogList>();
                        return Clone(_all);
                    }
                }

                /// <summary>
                /// Gets an id-only query template.
                /// </summary>
                public static XDocument IdOnly
                {
                    get
                    {
                        if (_idOnly != null) return Clone(_idOnly);
                        var idOnly = _template.Create<WITSML141.LogList>();
                        _template.RemoveAll(idOnly, "/*/*/*[name() != 'name' and name() != 'nameWell' and name() != 'nameWellbore']");
                        _idOnly = idOnly;
                        return Clone(_idOnly);
                    }
                }
                /// <summary>
                /// Create a header only query template.
                /// </summary>
                /// <returns></returns>
                public static XDocument HeaderOnly
                {
                    get
                    {
                        if (_headerOnly != null) return Clone(_headerOnly);
                        var headerOnly = _template.Create<WITSML141.LogList>();
                        _template.Remove(headerOnly, "//logData");
                        _headerOnly = headerOnly;
                        return Clone(_headerOnly);
                    }
                }

                /// <summary>
                ///  Create a data only query template.
                /// </summary>
                /// <returns></returns>
                public static XDocument DataOnly
                {
                    get
                    {
                        if (_dataOnly != null) return Clone(_dataOnly);
                        var dataOnly = _template.Create<WITSML141.LogList>();
                        _template.RemoveAll(dataOnly, "/*/*/*[name()!='logData']");
                        _dataOnly = dataOnly;
                        return Clone(_dataOnly);
                    }
                }

            }
            /// <summary>
            /// Provides helper methods to create Witsml141 query templates for message.    
            /// </summary>          
            public static class Message
            { 
                private static XDocument _all;
                private static XDocument _idOnly;

                /// <summary>
                /// Gets an all query template
                /// </summary>
                public static XDocument All
                {
                    get
                    {
                        if (_all != null) return Clone(_all);
                        _all = _template.Create<WITSML141.MessageList>();
                        return Clone(_all);
                    }
                }

                /// <summary>
                /// Gets an id-only query template.
                /// </summary>
                public static XDocument IdOnly
                {
                    get
                    {
                        if (_idOnly != null) return Clone(_idOnly);
                        var idOnly = _template.Create<WITSML141.MessageList>();
                        _template.RemoveAll(idOnly, "/*/*/*[name() != 'name' and name() != 'nameWell' and name() != 'nameWellbore']");
                        _idOnly = idOnly;
                        return Clone(_idOnly);
                    }
                }
            }
            /// <summary>
            /// Provides helper methods to create Witsml141 query templates for mudLog.    
            /// </summary>          
            public static class MudLog
            { 
                private static XDocument _all;
                private static XDocument _idOnly;
                private static XDocument _headerOnly;
                private static XDocument _dataOnly;

                /// <summary>
                /// Gets an all query template
                /// </summary>
                public static XDocument All
                {
                    get
                    {
                        if (_all != null) return Clone(_all);
                        _all = _template.Create<WITSML141.MudLogList>();
                        return Clone(_all);
                    }
                }

                /// <summary>
                /// Gets an id-only query template.
                /// </summary>
                public static XDocument IdOnly
                {
                    get
                    {
                        if (_idOnly != null) return Clone(_idOnly);
                        var idOnly = _template.Create<WITSML141.MudLogList>();
                        _template.RemoveAll(idOnly, "/*/*/*[name() != 'name' and name() != 'nameWell' and name() != 'nameWellbore']");
                        _idOnly = idOnly;
                        return Clone(_idOnly);
                    }
                }
                /// <summary>
                /// Create a header only query template.
                /// </summary>
                /// <returns></returns>
                public static XDocument HeaderOnly
                {
                    get
                    {
                        if (_headerOnly != null) return Clone(_headerOnly);
                        var headerOnly = _template.Create<WITSML141.MudLogList>();
                        _template.Remove(headerOnly, "//geologyInterval");
                        _headerOnly = headerOnly;
                        return Clone(_headerOnly);
                    }
                }

                /// <summary>
                ///  Create a data only query template.
                /// </summary>
                /// <returns></returns>
                public static XDocument DataOnly
                {
                    get
                    {
                        if (_dataOnly != null) return Clone(_dataOnly);
                        var dataOnly = _template.Create<WITSML141.MudLogList>();
                        _template.RemoveAll(dataOnly, "/*/*/*[name()!='geologyInterval']");
                        _dataOnly = dataOnly;
                        return Clone(_dataOnly);
                    }
                }

            }
            /// <summary>
            /// Provides helper methods to create Witsml141 query templates for opsReport.    
            /// </summary>          
            public static class OpsReport
            { 
                private static XDocument _all;
                private static XDocument _idOnly;

                /// <summary>
                /// Gets an all query template
                /// </summary>
                public static XDocument All
                {
                    get
                    {
                        if (_all != null) return Clone(_all);
                        _all = _template.Create<WITSML141.OpsReportList>();
                        return Clone(_all);
                    }
                }

                /// <summary>
                /// Gets an id-only query template.
                /// </summary>
                public static XDocument IdOnly
                {
                    get
                    {
                        if (_idOnly != null) return Clone(_idOnly);
                        var idOnly = _template.Create<WITSML141.OpsReportList>();
                        _template.RemoveAll(idOnly, "/*/*/*[name() != 'name' and name() != 'nameWell' and name() != 'nameWellbore']");
                        _idOnly = idOnly;
                        return Clone(_idOnly);
                    }
                }
            }
            /// <summary>
            /// Provides helper methods to create Witsml141 query templates for rig.    
            /// </summary>          
            public static class Rig
            { 
                private static XDocument _all;
                private static XDocument _idOnly;

                /// <summary>
                /// Gets an all query template
                /// </summary>
                public static XDocument All
                {
                    get
                    {
                        if (_all != null) return Clone(_all);
                        _all = _template.Create<WITSML141.RigList>();
                        return Clone(_all);
                    }
                }

                /// <summary>
                /// Gets an id-only query template.
                /// </summary>
                public static XDocument IdOnly
                {
                    get
                    {
                        if (_idOnly != null) return Clone(_idOnly);
                        var idOnly = _template.Create<WITSML141.RigList>();
                        _template.RemoveAll(idOnly, "/*/*/*[name() != 'name' and name() != 'nameWell' and name() != 'nameWellbore']");
                        _idOnly = idOnly;
                        return Clone(_idOnly);
                    }
                }
            }
            /// <summary>
            /// Provides helper methods to create Witsml141 query templates for risk.    
            /// </summary>          
            public static class Risk
            { 
                private static XDocument _all;
                private static XDocument _idOnly;

                /// <summary>
                /// Gets an all query template
                /// </summary>
                public static XDocument All
                {
                    get
                    {
                        if (_all != null) return Clone(_all);
                        _all = _template.Create<WITSML141.RiskList>();
                        return Clone(_all);
                    }
                }

                /// <summary>
                /// Gets an id-only query template.
                /// </summary>
                public static XDocument IdOnly
                {
                    get
                    {
                        if (_idOnly != null) return Clone(_idOnly);
                        var idOnly = _template.Create<WITSML141.RiskList>();
                        _template.RemoveAll(idOnly, "/*/*/*[name() != 'name' and name() != 'nameWell' and name() != 'nameWellbore']");
                        _idOnly = idOnly;
                        return Clone(_idOnly);
                    }
                }
            }
            /// <summary>
            /// Provides helper methods to create Witsml141 query templates for sidewallCore.    
            /// </summary>          
            public static class SidewallCore
            { 
                private static XDocument _all;
                private static XDocument _idOnly;

                /// <summary>
                /// Gets an all query template
                /// </summary>
                public static XDocument All
                {
                    get
                    {
                        if (_all != null) return Clone(_all);
                        _all = _template.Create<WITSML141.SidewallCoreList>();
                        return Clone(_all);
                    }
                }

                /// <summary>
                /// Gets an id-only query template.
                /// </summary>
                public static XDocument IdOnly
                {
                    get
                    {
                        if (_idOnly != null) return Clone(_idOnly);
                        var idOnly = _template.Create<WITSML141.SidewallCoreList>();
                        _template.RemoveAll(idOnly, "/*/*/*[name() != 'name' and name() != 'nameWell' and name() != 'nameWellbore']");
                        _idOnly = idOnly;
                        return Clone(_idOnly);
                    }
                }
            }
            /// <summary>
            /// Provides helper methods to create Witsml141 query templates for stimJob.    
            /// </summary>          
            public static class StimJob
            { 
                private static XDocument _all;
                private static XDocument _idOnly;

                /// <summary>
                /// Gets an all query template
                /// </summary>
                public static XDocument All
                {
                    get
                    {
                        if (_all != null) return Clone(_all);
                        _all = _template.Create<WITSML141.StimJobList>();
                        return Clone(_all);
                    }
                }

                /// <summary>
                /// Gets an id-only query template.
                /// </summary>
                public static XDocument IdOnly
                {
                    get
                    {
                        if (_idOnly != null) return Clone(_idOnly);
                        var idOnly = _template.Create<WITSML141.StimJobList>();
                        _template.RemoveAll(idOnly, "/*/*/*[name() != 'name' and name() != 'nameWell' and name() != 'nameWellbore']");
                        _idOnly = idOnly;
                        return Clone(_idOnly);
                    }
                }
            }
            /// <summary>
            /// Provides helper methods to create Witsml141 query templates for surveyProgram.    
            /// </summary>          
            public static class SurveyProgram
            { 
                private static XDocument _all;
                private static XDocument _idOnly;

                /// <summary>
                /// Gets an all query template
                /// </summary>
                public static XDocument All
                {
                    get
                    {
                        if (_all != null) return Clone(_all);
                        _all = _template.Create<WITSML141.SurveyProgramList>();
                        return Clone(_all);
                    }
                }

                /// <summary>
                /// Gets an id-only query template.
                /// </summary>
                public static XDocument IdOnly
                {
                    get
                    {
                        if (_idOnly != null) return Clone(_idOnly);
                        var idOnly = _template.Create<WITSML141.SurveyProgramList>();
                        _template.RemoveAll(idOnly, "/*/*/*[name() != 'name' and name() != 'nameWell' and name() != 'nameWellbore']");
                        _idOnly = idOnly;
                        return Clone(_idOnly);
                    }
                }
            }
            /// <summary>
            /// Provides helper methods to create Witsml141 query templates for target.    
            /// </summary>          
            public static class Target
            { 
                private static XDocument _all;
                private static XDocument _idOnly;

                /// <summary>
                /// Gets an all query template
                /// </summary>
                public static XDocument All
                {
                    get
                    {
                        if (_all != null) return Clone(_all);
                        _all = _template.Create<WITSML141.TargetList>();
                        return Clone(_all);
                    }
                }

                /// <summary>
                /// Gets an id-only query template.
                /// </summary>
                public static XDocument IdOnly
                {
                    get
                    {
                        if (_idOnly != null) return Clone(_idOnly);
                        var idOnly = _template.Create<WITSML141.TargetList>();
                        _template.RemoveAll(idOnly, "/*/*/*[name() != 'name' and name() != 'nameWell' and name() != 'nameWellbore']");
                        _idOnly = idOnly;
                        return Clone(_idOnly);
                    }
                }
            }
            /// <summary>
            /// Provides helper methods to create Witsml141 query templates for toolErrorModel.    
            /// </summary>          
            public static class ToolErrorModel
            { 
                private static XDocument _all;
                private static XDocument _idOnly;

                /// <summary>
                /// Gets an all query template
                /// </summary>
                public static XDocument All
                {
                    get
                    {
                        if (_all != null) return Clone(_all);
                        _all = _template.Create<WITSML141.ToolErrorModelList>();
                        return Clone(_all);
                    }
                }

                /// <summary>
                /// Gets an id-only query template.
                /// </summary>
                public static XDocument IdOnly
                {
                    get
                    {
                        if (_idOnly != null) return Clone(_idOnly);
                        var idOnly = _template.Create<WITSML141.ToolErrorModelList>();
                        _template.RemoveAll(idOnly, "/*/*/*[name() != 'name' and name() != 'nameWell' and name() != 'nameWellbore']");
                        _idOnly = idOnly;
                        return Clone(_idOnly);
                    }
                }
            }
            /// <summary>
            /// Provides helper methods to create Witsml141 query templates for toolErrorTermSet.    
            /// </summary>          
            public static class ToolErrorTermSet
            { 
                private static XDocument _all;
                private static XDocument _idOnly;

                /// <summary>
                /// Gets an all query template
                /// </summary>
                public static XDocument All
                {
                    get
                    {
                        if (_all != null) return Clone(_all);
                        _all = _template.Create<WITSML141.ToolErrorTermSetList>();
                        return Clone(_all);
                    }
                }

                /// <summary>
                /// Gets an id-only query template.
                /// </summary>
                public static XDocument IdOnly
                {
                    get
                    {
                        if (_idOnly != null) return Clone(_idOnly);
                        var idOnly = _template.Create<WITSML141.ToolErrorTermSetList>();
                        _template.RemoveAll(idOnly, "/*/*/*[name() != 'name' and name() != 'nameWell' and name() != 'nameWellbore']");
                        _idOnly = idOnly;
                        return Clone(_idOnly);
                    }
                }
            }
            /// <summary>
            /// Provides helper methods to create Witsml141 query templates for trajectory.    
            /// </summary>          
            public static class Trajectory
            { 
                private static XDocument _all;
                private static XDocument _idOnly;
                private static XDocument _headerOnly;
                private static XDocument _dataOnly;
                private static XDocument _stationLocationOnly;

                /// <summary>
                /// Gets an all query template
                /// </summary>
                public static XDocument All
                {
                    get
                    {
                        if (_all != null) return Clone(_all);
                        _all = _template.Create<WITSML141.TrajectoryList>();
                        return Clone(_all);
                    }
                }

                /// <summary>
                /// Gets an id-only query template.
                /// </summary>
                public static XDocument IdOnly
                {
                    get
                    {
                        if (_idOnly != null) return Clone(_idOnly);
                        var idOnly = _template.Create<WITSML141.TrajectoryList>();
                        _template.RemoveAll(idOnly, "/*/*/*[name() != 'name' and name() != 'nameWell' and name() != 'nameWellbore']");
                        _idOnly = idOnly;
                        return Clone(_idOnly);
                    }
                }
                /// <summary>
                /// Create a header only query template.
                /// </summary>
                /// <returns></returns>
                public static XDocument HeaderOnly
                {
                    get
                    {
                        if (_headerOnly != null) return Clone(_headerOnly);
                        var headerOnly = _template.Create<WITSML141.TrajectoryList>();
                        _template.Remove(headerOnly, "//trajectoryStation");
                        _headerOnly = headerOnly;
                        return Clone(_headerOnly);
                    }
                }

                /// <summary>
                ///  Create a data only query template.
                /// </summary>
                /// <returns></returns>
                public static XDocument DataOnly
                {
                    get
                    {
                        if (_dataOnly != null) return Clone(_dataOnly);
                        var dataOnly = _template.Create<WITSML141.TrajectoryList>();
                        _template.RemoveAll(dataOnly, "/*/*/*[name()!='trajectoryStation']");
                        _dataOnly = dataOnly;
                        return Clone(_dataOnly);
                    }
                }

                /// <summary>
                ///  Create a station location only query template.
                /// </summary>
                /// <returns></returns>
                public static XDocument StationLocationOnly
                {
                    get
                    {
                        if (_stationLocationOnly != null) return Clone(_stationLocationOnly);
                        var stationLocationOnly = _template.Create<WITSML141.TrajectoryList>();
                        _template.RemoveAll(stationLocationOnly, "/*/*/*[name()!='trajectoryStation']");
                        _template.RemoveAll(stationLocationOnly, "/*/*/*/*[name() != 'dTimStn' and name() != 'typeTrajStation' and name() != 'md' and name() != 'tvd' and name() != 'incl' and name() != 'azi' and name() != 'location']");
                        _stationLocationOnly = stationLocationOnly;
                        return Clone(_stationLocationOnly);
                    }
                }

            }
            /// <summary>
            /// Provides helper methods to create Witsml141 query templates for tubular.    
            /// </summary>          
            public static class Tubular
            { 
                private static XDocument _all;
                private static XDocument _idOnly;

                /// <summary>
                /// Gets an all query template
                /// </summary>
                public static XDocument All
                {
                    get
                    {
                        if (_all != null) return Clone(_all);
                        _all = _template.Create<WITSML141.TubularList>();
                        return Clone(_all);
                    }
                }

                /// <summary>
                /// Gets an id-only query template.
                /// </summary>
                public static XDocument IdOnly
                {
                    get
                    {
                        if (_idOnly != null) return Clone(_idOnly);
                        var idOnly = _template.Create<WITSML141.TubularList>();
                        _template.RemoveAll(idOnly, "/*/*/*[name() != 'name' and name() != 'nameWell' and name() != 'nameWellbore']");
                        _idOnly = idOnly;
                        return Clone(_idOnly);
                    }
                }
            }
            /// <summary>
            /// Provides helper methods to create Witsml141 query templates for wbGeometry.    
            /// </summary>          
            public static class WbGeometry
            { 
                private static XDocument _all;
                private static XDocument _idOnly;

                /// <summary>
                /// Gets an all query template
                /// </summary>
                public static XDocument All
                {
                    get
                    {
                        if (_all != null) return Clone(_all);
                        _all = _template.Create<WITSML141.WellboreGeometryList>();
                        return Clone(_all);
                    }
                }

                /// <summary>
                /// Gets an id-only query template.
                /// </summary>
                public static XDocument IdOnly
                {
                    get
                    {
                        if (_idOnly != null) return Clone(_idOnly);
                        var idOnly = _template.Create<WITSML141.WellboreGeometryList>();
                        _template.RemoveAll(idOnly, "/*/*/*[name() != 'name' and name() != 'nameWell' and name() != 'nameWellbore']");
                        _idOnly = idOnly;
                        return Clone(_idOnly);
                    }
                }
            }
            /// <summary>
            /// Provides helper methods to create Witsml141 query templates for well.    
            /// </summary>          
            public static class Well
            { 
                private static XDocument _all;
                private static XDocument _idOnly;

                /// <summary>
                /// Gets an all query template
                /// </summary>
                public static XDocument All
                {
                    get
                    {
                        if (_all != null) return Clone(_all);
                        _all = _template.Create<WITSML141.WellList>();
                        return Clone(_all);
                    }
                }

                /// <summary>
                /// Gets an id-only query template.
                /// </summary>
                public static XDocument IdOnly
                {
                    get
                    {
                        if (_idOnly != null) return Clone(_idOnly);
                        var idOnly = _template.Create<WITSML141.WellList>();
                        _template.RemoveAll(idOnly, "/*/*/*[name() != 'name' ]");
                        _idOnly = idOnly;
                        return Clone(_idOnly);
                    }
                }
            }
            /// <summary>
            /// Provides helper methods to create Witsml141 query templates for wellbore.    
            /// </summary>          
            public static class Wellbore
            { 
                private static XDocument _all;
                private static XDocument _idOnly;

                /// <summary>
                /// Gets an all query template
                /// </summary>
                public static XDocument All
                {
                    get
                    {
                        if (_all != null) return Clone(_all);
                        _all = _template.Create<WITSML141.WellboreList>();
                        return Clone(_all);
                    }
                }

                /// <summary>
                /// Gets an id-only query template.
                /// </summary>
                public static XDocument IdOnly
                {
                    get
                    {
                        if (_idOnly != null) return Clone(_idOnly);
                        var idOnly = _template.Create<WITSML141.WellboreList>();
                        _template.RemoveAll(idOnly, "/*/*/*[name() != 'name' and name() != 'nameWell']");
                        _idOnly = idOnly;
                        return Clone(_idOnly);
                    }
                }
            }
            /// <summary>
            /// Provides helper methods to create Witsml141 query templates for wellboreCompletion.    
            /// </summary>          
            public static class WellboreCompletion
            { 
                private static XDocument _all;
                private static XDocument _idOnly;

                /// <summary>
                /// Gets an all query template
                /// </summary>
                public static XDocument All
                {
                    get
                    {
                        if (_all != null) return Clone(_all);
                        _all = _template.Create<WITSML141.WellboreCompletionList>();
                        return Clone(_all);
                    }
                }

                /// <summary>
                /// Gets an id-only query template.
                /// </summary>
                public static XDocument IdOnly
                {
                    get
                    {
                        if (_idOnly != null) return Clone(_idOnly);
                        var idOnly = _template.Create<WITSML141.WellboreCompletionList>();
                        _template.RemoveAll(idOnly, "/*/*/*[name() != 'name' and name() != 'nameWell' and name() != 'nameWellbore']");
                        _idOnly = idOnly;
                        return Clone(_idOnly);
                    }
                }
            }
            /// <summary>
            /// Provides helper methods to create Witsml141 query templates for wellCMLedger.    
            /// </summary>          
            public static class WellCMLedger
            { 
                private static XDocument _all;
                private static XDocument _idOnly;

                /// <summary>
                /// Gets an all query template
                /// </summary>
                public static XDocument All
                {
                    get
                    {
                        if (_all != null) return Clone(_all);
                        _all = _template.Create<WITSML141.WellCMLedgerList>();
                        return Clone(_all);
                    }
                }

                /// <summary>
                /// Gets an id-only query template.
                /// </summary>
                public static XDocument IdOnly
                {
                    get
                    {
                        if (_idOnly != null) return Clone(_idOnly);
                        var idOnly = _template.Create<WITSML141.WellCMLedgerList>();
                        _template.RemoveAll(idOnly, "/*/*/*[name() != 'name' and name() != 'nameWell' and name() != 'nameWellbore']");
                        _idOnly = idOnly;
                        return Clone(_idOnly);
                    }
                }
            }
            /// <summary>
            /// Provides helper methods to create Witsml141 query templates for wellCompletion.    
            /// </summary>          
            public static class WellCompletion
            { 
                private static XDocument _all;
                private static XDocument _idOnly;

                /// <summary>
                /// Gets an all query template
                /// </summary>
                public static XDocument All
                {
                    get
                    {
                        if (_all != null) return Clone(_all);
                        _all = _template.Create<WITSML141.WellCompletionList>();
                        return Clone(_all);
                    }
                }

                /// <summary>
                /// Gets an id-only query template.
                /// </summary>
                public static XDocument IdOnly
                {
                    get
                    {
                        if (_idOnly != null) return Clone(_idOnly);
                        var idOnly = _template.Create<WITSML141.WellCompletionList>();
                        _template.RemoveAll(idOnly, "/*/*/*[name() != 'name' and name() != 'nameWell' and name() != 'nameWellbore']");
                        _idOnly = idOnly;
                        return Clone(_idOnly);
                    }
                }
            }
        }

        private static XDocument Clone(XDocument document) => new XDocument(document);
    }
}